<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            caret-color: transparent;
        }
        table{
            border-spacing: 1px;
            background-color: black; /*边线颜色*/
            border-collapse: separate; 
            width: 600px;
            margin: 100px auto;
        }
        td ,tr{
            background-color: #fff;
        }
        td, th{
            padding: 8px;
        }
        .header th {
            background-color: #ccc;
        }
        /* table {
            border-collapse: collapse;
        }
        table * {
            border: 1px solid black;
            
        } */
    </style>
</head>
<body>
    <table id="table">
        <tr class="header">
            <th>电影ID</th>
            <th>电影名称</th>
            <th>电影评分</th>
        </tr>
    </table>
</body>
<script>
    fetch("http://192.168.42.166:3000/show")
        .then(res => res.json())
        .then(res => {
            console.log(res);
            res.forEach(item => {
                let tr = document.createElement("tr");
                let content = `
                    <td>${item.movieId}</td>
                    <td>${item.movieName}</td>
                    <td>${item.movieOrange}</td>
                `
                tr.innerHTML = content;
                document.getElementById("table").appendChild(tr);
            });
        })
</script>
</html>